package com.rede.didiok.common.feign;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.rede.didiok.common.config.feign.FeignConfiguration;
import com.rede.didiok.common.dto.admin.LinkDto;
import com.rede.didiok.common.dto.user.MessagePushDto;
import com.rede.didiok.common.utils.R;


/**
 * 后台服务feign远程调用
 *
 * @author Rede
 * @date 2023年10月21日22:19:10
 */
@FeignClient(name = "didiok-admin", contextId = "didiok-admin0", configuration = FeignConfiguration.class)
public interface AdminFeignClient {


    /**
     * 获取系统配置信息
     */
//    @RequestMapping(value = "/admin/feign/systemConfig/getOneSystemConfig", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
//    R getOneSystemConfig();


    /**
     * 根据用户名，获取能够访问的菜单栏
     */
    @RequestMapping(value = "/admin/feign/categoryMenu/getCategoryMenuByUserName", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getCategoryMenuByUserName(@RequestParam("userName") String userName);
//
//    /**
//     * 获取一条系统配置信息
//     */
//    @RequestMapping(value = "/admin/systemConfig/getOneSystemConfig", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
//    String getOneSystemConfig(int status);

    /**
     * 通过 参数键名 获取参数值
     */
    @RequestMapping(value = "/admin/feign/sysParams/getSysParamsValueByKey", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getSysParamsValueByKey(@RequestParam("key")String key);

    /**
     * 通过 id 获取管理员
     */
    @RequestMapping(value = "/admin/feign/admin/getNicknameById", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getAdminNicknameById(@RequestParam("uid")String uid);

    /**
     * 通过 id 获取管理员
     */
    @RequestMapping(value = "/admin/feign/admin/getMe", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getMe();

    /**
     * 通过 ids 获取管理员列表
     */
    @RequestMapping(value = "/admin/feign/admin/getAdminListByUids", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getAdminListByUids(@RequestBody Collection<String> adminUidList);

    /**
     * 通过 id 获取管理员
     */
    @RequestMapping(value = "/admin/feign/admin/getAdminByUid", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getAdminByUid(@RequestParam("adminUid") String adminUid);

    /**
     * 通过 ids 获取管理员(不包括 photoUrl)
     */
    @RequestMapping(value = "/admin/feign/admin/getAdminListWithoutPhotoByUid", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getAdminListWithoutPhotoByUid(@RequestBody Set<String> adminUidList);

    /**
     * 通过 ids 查询友链
     */
    @RequestMapping(value = "/admin/feign/link/lisLinktByUids", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R lisLinktByUids(@RequestBody List<String> linkUids);

    /**
     * 根据 userUid 查询绑定的管理员账号数量
     */
    @RequestMapping(value = "/admin/feign/admin/countAdminByUserUid", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    Integer countAdminByUserUid(@RequestParam("userUid") String userUid);



    /**
     * 获取系统配置信息
     */
    @RequestMapping(value = "/admin/feign/systemConfig/getSystemConfig", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getSystemConfig();

    /**
     * 通过 参数键名 获取参数值
     */
    @RequestMapping(value = "/admin/feign/webConfig/isOpenLoginType", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R isOpenLoginType(@RequestParam("loginType")String loginType);

    /**
     * 根据用户uid和友链名获取一条连接
     * @param userUid
     * @param title
     * @return
     */
    @RequestMapping(value = "/admin/feign/link/getLinkByUserUidAndTitle", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getLinkByUserUidAndTitle(@RequestParam("userUid") String userUid, @RequestParam("title")String title);

    /**
     * 保存一条友链
     * @param linkDto
     * @return
     */
    @RequestMapping(value = "/admin/feign/link/add", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R addOneLink(@RequestBody LinkDto linkDto);

    /**
     * 获取一条网站配置
     * @param linkDto
     * @return
     */
    @RequestMapping(value = "/admin/feign/webConfig/getWebConfig", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getWebConfig();

    /**
     * 通过 id 更新管理员密码
     * @param adminUid
     * @return
     */
    @RequestMapping(value = "/admin/feign/admin/updateAdminPasswordById", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R updateAdminPasswordById(@RequestParam("adminUid") String adminUid,@RequestParam("password") String password);

    /**
     * 通过 id 更新消息推送数据
     * @param messagePush
     * @return
     */
    @RequestMapping(value = "/admin/feign/messagePush/updateMessagePushById", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R updateMessagePushById(@RequestBody MessagePushDto messagePush);
}